﻿<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true" CodeFile="Details.aspx.cs" Inherits="Details" Title="Untitled Page" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
     
    <style type="text/css">
        .style6
    {
        width: 112%;
    }
        .style7
        {
            width: 19%;
        }
        .style8
        {
            width: 126px;
        }
        .style9
        {
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 12px;
            color: #000000;
            text-align: center;
            width: 126px;
        }
    </style>
    
     
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   
    <br />
    <br />
    <table width="100%" border="0" style="font-weight:bold" cellpadding="4" cellspacing="0">
    <tr>
        <td class="table_header">Chi tiết sản phẩm</td>
    </tr>
    <tr>
        <td>
            <table >
                <tr>
                    <td>
                        <asp:Image ID="Image" runat="server" Height="200px" Width="200px" />         
                    </td>
                    <td>&nbsp;</td>
                    <td>
                        <table>
                            <tr>
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">Ten san pham : </td>
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">
                                &nbsp;&nbsp;<asp:Label ID="TenSanPham" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                </td>
                            </tr>
                            <tr style="font-size: 11pt; font-weight: bold; color: #FFFFFF;">
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">Tinh trang : </td>
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">
                                &nbsp;
                                <asp:Label ID="Tinhtrang" runat="server" Text="Label"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                            <% 
                            String IDSanPham = Request.QueryString["itemID"];
                            DTO.SanPhamDto sanpham = BUS.SanPhamBus.LaySanPhamTheoID(int.Parse(IDSanPham));
                            int songay = (DateTime.Today - sanpham.NgayNhap).Days;    
                            %>
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">Giá sản phẩm : </td>
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">                    
                                &nbsp;&nbsp;
                            <%
                                if (sanpham.IDKhuyenMai != 4) // co khuyen mai ( 4 : khong khuyen mai)
                                {    
                            %>
                                <asp:Label ID="GiaCu" runat="server" CssClass="login_text" ForeColor="White" 
                                Text="Label" Font-Strikeout="True"></asp:Label>  
                                
                                <asp:Label ID="GiaGiam" runat="server" CssClass="login_text" ForeColor="White" 
                                Text="Label"></asp:Label>
                            <% }%> 
                            <% else
                               {
                            %> 
                                <asp:Label ID="Gia" runat="server" CssClass="login_text" ForeColor="White" 
                                Text="Label"></asp:Label>  
                                
                            <% } %>
                            
                            <% if (songay < 30)
                               {
                            %>
                                   <img alt="" src='images/new.gif' width='26px' height='26px' />      
                            <% }%>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">Số luợng : </td>
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">
                                &nbsp;&nbsp;<asp:Label ID="soluong" runat="server" CssClass="login_text" ForeColor="White" 
                                Text="Label"></asp:Label>
                                
                                </td>
                            </tr>
                            <tr>
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">Đánh giá : </td>
                                <td>
                                    &nbsp;&nbsp;
                                    <asp:ScriptManager ID="ScriptManager1" runat="server">
                                    </asp:ScriptManager>
                                    <asp:Rating ID="Rating1" runat="server" EmptyStarCssClass="rating_empty" 
                                                FilledStarCssClass="rating_filled" WaitingStarCssClass="rating_empty" 
                                                StarCssClass="rating_star" MaxRating="10" 
                                        onchanged="Rating1_Changed" AutoPostBack="True" >
                                    </asp:Rating>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">Mua hàng : </td>
                                <td style="font-size: 11pt; font-weight: bold; color: #FFFFFF">
                                &nbsp;&nbsp;
                                <asp:HyperLink ID="Gio" runat="server" ImageUrl="~/images/index_56.gif" >ThemGio</asp:HyperLink>
                                
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>
        <%
            if (Session["user"] != null)
            {
        %>
            <table width="70%" align="center" border="1" cellpadding="4" cellspacing="0" style="background-color:#C2DD45">
                <tr>
                    <td colspan="2" align="left" style="background-color:Black"><span class="extraMark">Ý kiến của bạn:</span></td>
                </tr>
                <tr>
                    <td colspan="2"><asp:TextBox runat="server" ID="txtCommentContent" CssClass="textfield" 
                            TextMode="MultiLine" Width="100%"></asp:TextBox>
                        <asp:Label runat="server" ID="lblContentErr"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td><span style="color:#7C0B8A">Mã an toàn:</span></td> 
                    <td><cc1:CaptchaControl ID="sercureCode" runat="server" Width="182px" /></td>
                </tr> 
                <tr>
                    <td valign="top"><span style="color:#7C0B8A">Xác nhận mã:</span></td>
                    <td>
                        <asp:TextBox runat="server" ID="txtConfirmSecureCode" CssClass="textfield"></asp:TextBox><br/>
                        <asp:Label runat="server" ID="lblSecureCodeErr"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td><asp:Button ID="btnSubmit" runat="server" Text="Gửi ý kiến" 
                            onclick="btnSubmit_Click" /></td>
                </tr>
            </table>
        <%
            } 
        %>
        </td>
    </tr>
    <tr>
        <td id="tdCustomerComments">
            <table width="100%" align="left" border="1" cellpadding="0" cellspacing="0">
                <tr>
                    <td style="background-color:Black">
                        <asp:Label ID="Label5" runat="server" CssClass="login_text" ForeColor="White" 
                            Text="Nhận xét của khách hàng:" Font-Bold="True"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <%Session["i"] = 0; %>
                        <asp:DataList ID="DataNhanXet" runat="server" CellPadding="0" Width="100%">
                            <ItemTemplate>
                                <%
                                    int i = (int)Session["i"];
                                    if (i % 2 == 0)
                                    {
                                %>
                                <table width="100%" cellpadding="4" style="background-color:White">
                                <% 
                                    }
                                    else
                                    {     
                                %>
                                <table width="100%" cellpadding="4" style="background-color:#C9C6CA">
                                <% 
                                    }
                                    i++;
                                    Session["i"] = i;
                                %>
                                    <tr>
                                        <td style="color:Black; width:60%">
                                        <% 
                                            DTO.NguoiDungDto user = (DTO.NguoiDungDto)Session["user"];
                                            if (user!= null && (user.LoaiNguoiDung == 1 || user.LoaiNguoiDung == 3))
                                            {
                                        %>
                                            <asp:HyperLink runat="server" NavigateUrl='<%# "Details.aspx?itemID=" + Eval("MaSanPham") + "&IDComment=" + Eval("ID") %>'><img src="images/cancel_48.png" width="20" height="15" alt="" /></asp:HyperLink> &nbsp;
                                        <%
                                            }
                                        %>
                                            <asp:Label runat="server" ID='lblComment' Text='<%# Eval("NoiDung") %>' ></asp:Label>
                                        </td>
                                        <td style="color:Blue; width:15%">
                                            <asp:Label runat="server" ID="lblUserName" Text='<%# Eval("TenNguoiDung") %>'></asp:Label>
                                        </td>
                                        <td style="color:Black">
                                            <asp:Label runat="server" ID="lblPostDate" Text='<%# Eval("ThoiDiem") %>'></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </ItemTemplate>
                        </asp:DataList>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    </table>
    <br />
</asp:Content>

